home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 4 / Apprentice-Release4.iso / Languages / MPW Oberon 2.1168 / OInterfaces / ADSP.mod next >
Encoding:
Text File  |  1995-08-10  |  9.9 KB  |  237 lines  |  [TEXT/MPS ]

  1. (*
  2.      File:        ADSP.mod
  3.  
  4.      Contains:    AppleTalk Data Stream Protocol (ADSP) Interfaces.
  5.  
  6.      Version:    Technology:    System 7.5
  7.                  Package:    Universal Interfaces 2.0 in “MPW Latest” on ETO #17
  8.  
  9.      Copyright:    © 1984-1995 by Apple Computer, Inc.
  10.                  All rights reserved.
  11.  
  12.      Bugs?:        If you find a problem with this file, use the Apple Bug Reporter
  13.                  stack.  Include the file and version information (from above)
  14.                  in the problem description and send to:
  15.                      Internet:    apple.bugs.applelink.apple.com
  16.                      AppleLink:    APPLE.BUGS
  17.  
  18. *)
  19.  
  20. (*$TAGS-*)
  21. (*$CALLING PASCAL*)
  22. MODULE ADSP;
  23.  
  24. IMPORT SYSTEM, Types, OSUtils, AppleTalk;
  25.  
  26. (* $PUSH*)
  27. (* $ALIGN MAC68K*)
  28. (* $LibExport+*)
  29.  
  30. CONST
  31.     dspInit*                        = 255;                            (* create a new connection end *)
  32.     dspRemove*                    = 254;                            (* remove a connection end *)
  33.     dspOpen*                        = 253;                            (* open a connection *)
  34.     dspClose*                    = 252;                            (* close a connection *)
  35.     dspCLInit*                    = 251;                            (* create a connection listener *)
  36.     dspCLRemove*                    = 250;                            (* remove a connection listener *)
  37.     dspCLListen*                    = 249;                            (* post a listener request *)
  38.     dspCLDeny*                    = 248;                            (* deny an open connection request *)
  39.     dspStatus*                    = 247;                            (* get status of connection end *)
  40.     dspRead*                        = 246;                            (* read data from the connection *)
  41.     dspWrite*                    = 245;                            (* write data on the connection *)
  42.     dspAttention*                = 244;                            (* send an attention message *)
  43.  
  44.     dspOptions*                    = 243;                            (* set connection end options *)
  45.     dspReset*                    = 242;                            (* forward reset the connection *)
  46.     dspNewCID*                    = 241;                            (* generate a cid for a connection end *)
  47. (* connection opening modes *)
  48.     ocRequest*                    = 1;                            (* request a connection with remote *)
  49.     ocPassive*                    = 2;                            (* wait for a connection request from remote *)
  50.     ocAccept*                    = 3;                            (* accept request as delivered by listener *)
  51.     ocEstablish*                    = 4;                            (* consider connection to be open *)
  52. (* connection end states *)
  53.     sListening*                    = 1;                            (* for connection listeners *)
  54.     sPassive*                    = 2;                            (* waiting for a connection request from remote *)
  55.     sOpening*                    = 3;                            (* requesting a connection with remote *)
  56.     sOpen*                        = 4;                            (* connection is open *)
  57.     sClosing*                    = 5;                            (* connection is being torn down *)
  58.     sClosed*                        = 6;                            (* connection end state is closed *)
  59. (* client event flags *)
  60.     eClosed*                        = $80;                            (* received connection closed advice *)
  61.     eTearDown*                    = $40;                            (* connection closed due to broken connection *)
  62.     eAttention*                    = $20;                            (* received attention message *)
  63.     eFwdReset*                    = $10;                            (* received forward reset advice *)
  64. (* miscellaneous constants *)
  65.     attnBufSize*                    = 570;                            (* size of client attention buffer *)
  66.     minDSPQueueSize*                = 100;                            (* Minimum size of receive or send Queue *)
  67.  
  68. (* connection control block *)
  69.  
  70. TYPE
  71.     TPCCB* = POINTER TO TRCCB;
  72.  
  73.     TRCCB* = (*ΔΔPACKEDΔΔ*) RECORD
  74.         ccbLink*:                TPCCB (*ΔΔ POINTER TO TRCCB*);                                    (* link to next ccb *)
  75.         refNum*:                    Types.UInt16;                                    (* user reference number *)
  76.         state*:                    Types.UInt16;                                    (* state of the connection end *)
  77.         userFlags*:                Types.UInt8;                                    (* flags for unsolicited connection events *)
  78.         localSocket*:            Types.UInt8;                                    (* socket number of this connection end *)
  79.         remoteAddress*:            AppleTalk.AddrBlock;                                (* internet address of remote end *)
  80.         attnCode*:                Types.UInt16;                                    (* attention code received *)
  81.         attnSize*:                Types.UInt16;                                    (* size of received attention data *)
  82.         attnPtr*:                Types.Ptr;                                    (* ptr to received attention data *)
  83.         reserved*:                (*ΔΔPACKEDΔΔ*) ARRAY 220 (*ΔΔ[0..219]ΔΔ*) OF Types.UInt8;            (* for adsp internal use *)
  84.     END;
  85.  
  86.     DSPPBPtr* = POINTER TO DSPParamBlock;
  87.  
  88.     (*
  89.         ADSPConnectionEventProcPtr uses register based parameters on the 68k and cannot
  90.         be written in or called from a high-level language without the help of
  91.         mixed mode or assembly glue.
  92.  
  93.         In*:
  94.          => sourceCCB       A1.L
  95.     *)
  96.     ADSPConnectionEventProcPtr* = Types.Register68kProcPtr;  (* register PROCEDURE ADSPConnectionEvent*(sourceCCB: TPCCB); *)
  97.     (*
  98.         ADSPCompletionProcPtr uses register based parameters on the 68k and cannot
  99.         be written in or called from a high-level language without the help of
  100.         mixed mode or assembly glue.
  101.  
  102.         In*:
  103.          => thePBPtr        A0.L
  104.     *)
  105.     ADSPCompletionProcPtr* = Types.Register68kProcPtr;  (* register PROCEDURE ADSPCompletion*(thePBPtr: DSPPBPtr); *)
  106.     ADSPConnectionEventUPP* = Types.UniversalProcPtr;
  107.     ADSPCompletionUPP* = Types.UniversalProcPtr;
  108.  
  109.     DSPParamBlock* = (*ΔΔPACKEDΔΔ*) RECORD
  110.         qLink*:                    OSUtils.QElemPtr (*ΔΔ POINTER TO OSUtils.QElem*);
  111.         qType*:                    INTEGER;
  112.         ioTrap*:                    INTEGER;
  113.         ioCmdAddr*:                Types.Ptr;
  114.         ioCompletion*:            ADSPCompletionUPP;
  115.         ioResult*:                Types.OSErr;
  116.         ioNamePtr*:                Types.StringPtr;
  117.         ioVRefNum*:                INTEGER;
  118.         ioCRefNum*:                INTEGER;                                (* adsp driver refNum *)
  119.         csCode*:                    INTEGER;                                (* adsp driver control code *)
  120.         qStatus*:                LONGINT;                                (* adsp internal use *)
  121.         ccbRefNum*:                INTEGER;
  122.         (*ΔΔ CASE INTEGER OF
  123.         0: ( *)
  124.     END;
  125.     DSPInitParamBlock* = RECORD(DSPParamBlock)
  126.             ccbPtr*:                        TPCCB;                                (* pointer to connection control block *)
  127.             userRoutine*:                ADSPConnectionEventUPP;                (* client routine to call on event *)
  128.             sendQSize*:                    Types.UInt16;                                (* size of send queue (0..64K bytes) *)
  129.             sendQueue*:                    Types.Ptr;                                (* client passed send queue buffer *)
  130.             recvQSize*:                    Types.UInt16;                                (* size of receive queue (0..64K bytes) *)
  131.             recvQueue*:                    Types.Ptr;                                (* client passed receive queue buffer *)
  132.             attnPtr*:                    Types.Ptr;                                (* client passed receive attention buffer *)
  133.             localSocket*:                Types.UInt8;                                (* local socket number *)
  134.             filler1*:                    Types.UInt8;                                (* filler for proper byte alignment *)
  135.            (*ΔΔ );
  136.         1: ( *)
  137.     END;
  138.     DSPCLInitParamBlock* = DSPInitParamBlock;
  139.     DSPOpenParamBlock* = RECORD(DSPParamBlock)
  140.             localCID*:                    Types.UInt16;                                (* local connection id *)
  141.             remoteCID*:                    Types.UInt16;                                (* remote connection id *)
  142.             remoteAddress*:                AppleTalk.AddrBlock;                            (* address of remote end *)
  143.             filterAddress*:                AppleTalk.AddrBlock;                            (* address filter *)
  144.             sendSeq*:                    Types.UInt32;                                (* local send sequence number *)
  145.             sendWindow*:                    Types.UInt16;                                (* send window size *)
  146.             recvSeq*:                    Types.UInt32;                                (* receive sequence number *)
  147.             attnSendSeq*:                Types.UInt32;                                (* attention send sequence number *)
  148.             attnRecvSeq*:                Types.UInt32;                                (* attention receive sequence number *)
  149.             ocMode*:                        Types.UInt8;                                (* open connection mode *)
  150.             ocInterval*:                    Types.UInt8;                                (* open connection request retry interval *)
  151.             ocMaximum*:                    Types.UInt8;                                (* open connection request retry maximum *)
  152.             filler2*:                    Types.UInt8;                                (* filler for proper byte alignment *)
  153.            (*ΔΔ );
  154.         2: ( *)
  155.     END;
  156.     DSPCLListenParamBlock* = DSPOpenParamBlock;
  157.     DSPCLDenyParamBlock* = DSPOpenParamBlock;
  158.     DSPCloseParamBlock* = RECORD(DSPParamBlock)
  159.             abort*:                        Types.UInt8;                                (* abort connection immediately if non-zero *)
  160.             filler3*:                    Types.UInt8;                                (* filler for proper byte alignment *)
  161.            (*ΔΔ );
  162.         3: ( *)
  163.     END;
  164.     DSPRemoveParamBlock* = DSPCloseParamBlock;
  165.     DSPReadParamBlock* = RECORD(DSPParamBlock)
  166.             reqCount*:                    Types.UInt16;                                (* requested number of bytes *)
  167.             actCount*:                    Types.UInt16;                                (* actual number of bytes *)
  168.             dataPtr*:                    Types.Ptr;                                (* pointer to data buffer *)
  169.             eom*:                        Types.UInt8;                                (* indicates logical end of message *)
  170.             flush*:                        Types.UInt8;                                (* send data now *)
  171.            (*ΔΔ );
  172.         4: ( *)
  173.     END;
  174.     DSPWriteParamBlock* = DSPReadParamBlock;
  175.     DSPAttentionParamBlock* = RECORD(DSPParamBlock)
  176.             attnCode*:                    Types.UInt16;                                (* client attention code *)
  177.             attnSize*:                    Types.UInt16;                                (* size of attention data *)
  178.             attnData*:                    Types.Ptr;                                (* pointer to attention data *)
  179.             attnInterval*:                Types.UInt8;                                (* retransmit timer in 10-tick intervals *)
  180.             filler4*:                    Types.UInt8;                                (* filler for proper byte alignment *)
  181.            (*ΔΔ );
  182.         5: ( *)
  183.     END;
  184.     DSPStatusParamBloc* = RECORD(DSPParamBlock)
  185.             statusCCB*:                    TPCCB;                                (* pointer to ccb *)
  186.             sendQPending*:                Types.UInt16;                                (* pending bytes in send queue *)
  187.             sendQFree*:                    Types.UInt16;                                (* available buffer space in send queue *)
  188.             recvQPending*:                Types.UInt16;                                (* pending bytes in receive queue *)
  189.             recvQFree*:                    Types.UInt16;                                (* available buffer space in receive queue *)
  190.            (*ΔΔ );
  191.         6: ( *)
  192.     END;
  193.     DSPOptionsParamBlock* = RECORD(DSPParamBlock)
  194.             sendBlocking*:                Types.UInt16;                                (* quantum for data packets *)
  195.             sendTimer*:                    Types.UInt8;                                (* send timer in 10-tick intervals *)
  196.             rtmtTimer*:                    Types.UInt8;                                (* retransmit timer in 10-tick intervals *)
  197.             badSeqMax*:                    Types.UInt8;                                (* threshold for sending retransmit advice *)
  198.             useCheckSum*:                Types.UInt8;                                (* use ddp packet checksum *)
  199.            (*ΔΔ );
  200.         7: ( *)
  201.     END;
  202.     DSPNewCIDParamBlock* = RECORD(DSPParamBlock)
  203.             newcid*:                        Types.UInt16;                                (* new connection id returned *)
  204.            (*ΔΔ );*)
  205.     END;
  206.  
  207. CONST
  208.     uppADSPConnectionEventProcInfo* = $0000B802; (* Register PROCEDURE (4 bytes in A1); *)
  209.     uppADSPCompletionProcInfo* = $00009802; (* Register PROCEDURE (4 bytes in A0); *)
  210.  
  211. PROCEDURE NewADSPConnectionEventProc*(userRoutine: ADSPConnectionEventProcPtr): ADSPConnectionEventUPP;
  212.     (*$IF NOT GENERATINGCFM *)
  213.     INLINE PASCAL $2E9F;
  214.     (*$END*)
  215.  
  216. PROCEDURE NewADSPCompletionProc*(userRoutine: ADSPCompletionProcPtr): ADSPCompletionUPP;
  217.     (*$IF NOT GENERATINGCFM *)
  218.     INLINE PASCAL $2E9F;
  219.     (*$END*)
  220.  
  221. PROCEDURE CallADSPConnectionEventProc*(sourceCCB: TPCCB; userRoutine: ADSPConnectionEventUPP);
  222.     (*$IF NOT GENERATINGCFM*)
  223.     INLINE PASCAL ; (*••*)
  224.     (*To be implemented:  Glue to move parameters into registers.*)
  225.     (*$END*)
  226.  
  227. PROCEDURE CallADSPCompletionProc*(thePBPtr: DSPPBPtr; userRoutine: ADSPCompletionUPP);
  228.     (*$IF NOT GENERATINGCFM*)
  229.     INLINE PASCAL ; (*••*)
  230.     (*To be implemented:  Glue to move parameters into registers.*)
  231.     (*$END*)
  232.  
  233. (* $ALIGN RESET*)
  234. (* $POP*)
  235.  
  236.  END ADSP.
  237.